﻿@model DingTalkAgent.Model.Dictionary
@{
    ViewBag.Title = "Add";
    Layout = null;
}

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h4 class="modal-title">字典添加</h4>
</div>
<div class="modal-body">
@using (Html.BeginForm("Add", "Dictionary", FormMethod.Post, new { id = "form_Add", name = "form_Add" }))
            {
        <table cellspacing="0" cellpadding="0" width="100%" class="table">

            <tr>
                <th>
                    父级：
                </th>
                <td>
                    @Html.HiddenFor(model => model.Parent_ID, new { @class = "form-control" })
                    @Model.ParentName
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="must">*</span>条目名称：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    排序编号：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.OrderID, new { @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    备注：
                </th>
                <td>
                    @Html.TextAreaFor(model => model.Remark, new { rows = 5, cols = 70, @class = "form-control" })
                    <div>
                    </div>
                </td>
            </tr>
        </table>
    }
    <div class="remark">
        <div class="remark_tit">
            <span></span>温馨提示
        </div>
        <div class="remark_content">
            <p>
                <span class="must">*</span>必须填写。
            </p>
        </div>
    </div>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
    <button type="button" class="btn btn-primary" id="Add">保存</button>
</div>

<script type="text/javascript">
    var Validater;
    $(document).ready(function () {
        //验证
        Validater = $("form").validate({
            rules: {
                Name: {
                    required: true,
                }
            },
            messages: {
        }
    });
    $("#Add").click(function () {
        if (Validater.form()) {
            SetData("/Dictionary/Add", '信息添加成功!');
        }
    });
});
</script>
